<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue v-for 事件</title>
    <script src="./js/vue.min.js"></script>
</head>
<body>

    <div id="vm">
        <div>
            <input type="text" 
            v-on:keyup.enter="key_enter" 
            v-on:keyup.esc="key_esc"
            v-on:keyup.space="key_space"
            v-on:keyup.delete="key_delete"
            v-on:keyup.up="key_up"
            />
        </div>
        <p>Enter</p>
        <p>ESC</p>
        <p>DELETE</p>
        <p>TAB</p>
        <p>SPACE</p>
        <p>UP</p>
        <p>DOWN</p>
        <p>LEFT</p>
        <p>RIGHT</p>
    </div>

    <script>

        var vm = new Vue({
            el: '#vm',
            data: {
            },
            methods:{
                key_enter(){
                    alert('你按了回车键');
                },
                key_esc(){
                    alert('你按了ESC键');
                },
                key_space(){
                    alert('你按了空格键');
                },
                key_delete(){
                    alert('你按了删除键');
                },
                key_up(){
                    alert('你按了向上键');
                }
            }
        });

    </script>
    
</body>
</html>